home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / xcmd / pckpbkgn.sit / PickupBkgnd XCMD v2 / card_3368.txt < prev    next >
Text File  |  1990-06-06  |  3KB  |  108 lines

  1. -- card: 3368 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 2699
  5. -- name: 
  6.  
  7.  
  8. -- part 1 (button)
  9. -- low flags: 00
  10. -- high flags: 8003
  11. -- rect: left=316 top=44 right=66 bottom=400
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 1
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: Install it
  20. ----- HyperTalk script -----
  21. on mouseUp
  22.   push card
  23.   set lockMessages to true
  24.   put the script of btn "on doMenu script" into myScript
  25.   put char 1 to offset(return&return,myScript) of myScript into myScript
  26.   put the long name of this stack into source
  27.   delete first word of source  -- "stack"
  28.   delete first char of source  -- quote
  29.   delete last char of source  -- quote
  30.   go to stack "the target stack"
  31.   put the script of this stack into dstScript
  32.   if dstScript contains "on doMenu"
  33.   then abort "ΓÇ£on doMenuΓÇ¥ already exists in stack script!"
  34.   put the long name of this stack into dest
  35.   delete first word of dest  -- "stack"
  36.   delete first char of dest  -- quote
  37.   delete last char of dest  -- quote
  38.   if source = dest then abort "Installation cancelled."
  39.   answer "Do you have ResCopy in your home stack?" with "Yes" or "No"
  40.   if it is "Yes" then installResources source,dest
  41.   else answer "Move XCMD & STR# resources using ResEdit."
  42.   put return & dstScript after myScript
  43.   set the script of this stack to myScript
  44.   answer "Installation successful."
  45.   pop card
  46. end mouseUp
  47.  
  48. on installResources source,dest
  49.   resCopy source,dest,"XCMD",19831
  50.   if the result is not empty
  51.   then abort "Error installing XCMD resource."
  52.   resCopy source,dest,"STR#",19831
  53.   if the result is not empty
  54.   then abort "Error installing string (STR#) resource."
  55. end installResources
  56.  
  57. on abort theText
  58.   answer theText
  59.   pop card
  60.   exit to HyperCard
  61. end abort
  62.  
  63.  
  64.  
  65. -- part 2 (button)
  66. -- low flags: 00
  67. -- high flags: 8002
  68. -- rect: left=408 top=254 right=276 bottom=496
  69. -- title width / last selected line: 0
  70. -- icon id / first selected line: 0 / 0
  71. -- text alignment: 1
  72. -- font id: 3
  73. -- text size: 9
  74. -- style flags: 0
  75. -- line height: 12
  76. -- part name: on doMenu script
  77. ----- HyperTalk script -----
  78. on doMenu theItem
  79.   if (theItem is "Paste Card") and (the optionKey is down) then
  80.     answer "The card will be pasted with current bkgnd." with "OK" or "Cancel"
  81.     if it is not "OK" then exit doMenu
  82.     pickupBkgnd  --call the XCMD, converting contents of the clipboard
  83.     get the result
  84.     if it is not empty then
  85.       answer it
  86.       exit doMenu
  87.     end if
  88.   end if
  89.   pass doMenu
  90. end doMenu
  91.  
  92. --the following handler is not copied by the installation button
  93. on mouseUp
  94.   edit script of me
  95. end mouseUp
  96.  
  97.  
  98. -- part contents for background part 1
  99. ----- text -----
  100. Click the button above to install the PickUpBkgnd XCMD into the stack of your choice.
  101.  
  102. The installation adds a ΓÇ£on doMenuΓÇ¥ handler to the stack script of the target stack so that you can use the option-paste feature.
  103.  
  104. If you have ResCopy, the XCMD and STR# resources will be copied. Otherwise, you will have to copy the resources with ResEdit or something like it.
  105.  
  106. -- part contents for background part 9
  107. ----- text -----
  108. Installation